package com.binfast.app.admin.services.impl;

import com.binfast.app.admin.services.AdminMenuServ;
import com.binfast.bean.dto.adminMenu.AdminMenuListDTO;
import com.binfast.bean.model.auth.AdminMenu;
import com.binfast.seed.base.BaseService;
import com.binfast.service.dao.auth.AdminMenuDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminMenuServImpl extends BaseService implements AdminMenuServ {

    @Autowired
    AdminMenuDao adminMenuDao;

    @Override
    public AdminMenuListDTO findList() {
        List<AdminMenu> menuList =  adminMenuDao.findList();
        List<AdminMenu> result = AdminMenu.generateTreeMenu(menuList);
        AdminMenuListDTO dto = new AdminMenuListDTO();
        dto.setDataList(result);
        return dto;
    }
}
